package org.jeecg.modules.pdd.job;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pdd.pop.sdk.http.api.pop.response.PddDdkGoodsPidGenerateResponse;
import com.pdd.pop.sdk.http.api.pop.response.PddDdkGoodsPidQueryResponse;
import com.taobao.api.ApiException;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.mall.service.IDtkManager;
import org.jeecg.modules.pdd.entity.PddPromotion;
import org.jeecg.modules.pdd.service.IPddGoodsRecommendService;
import org.jeecg.modules.pdd.service.IPddGoodsService;
import org.jeecg.modules.pdd.service.IPddPromotionService;
import org.jeecg.modules.pdd.util.PddUtil;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 每天凌晨2点定时从大淘客网站获取最新商品信息
 * </p>
 * 9/29
 */
@Slf4j
public class PDDGoodsTask implements Job {

    @Autowired
    private IPddGoodsService pddGoodsService;

    @Autowired
    private IPddGoodsRecommendService pddGoodsRecommendService;

    @Autowired
    private IPddPromotionService pddPromotionService;

    /**
     * 定时任务执行入口
     */
    @SneakyThrows
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        log.info("大淘客定时任务开始运行,dateTime:{}", DateUtils.now());
        pddGoodsService.updateGoodsData();

        pddGoodsRecommendService.updateGoodsData();
        log.info("大淘客定时任务开始结束,dateTime:{}", DateUtils.now());
    }
}